﻿using Angle.Krill.Utils;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WeifenLuo.WinFormsUI.Docking;

namespace Angle.Krill
{
    internal static class DockContentHelper
    {
        public static void ShowFilesForm(this DockPanel dockPanel, string folderPath)
        {
            DockHelper.Show(dockPanel, typeof(Files), DockState.Document, new AdditionalParam
            {
                Icon = "fa-file",
                Text = $"{Path.GetFileName(folderPath)}({folderPath})",
                Data = new List<AdditionalParamInfo>
                    {
                        new AdditionalParamInfo
                        {
                            Key="folderPath",
                            Value=folderPath
                        }
                    }
            });
        }
        public static void ShowExplorerForm(this DockPanel dockPanel)
        {
            DockHelper.Show(dockPanel, typeof(Explorer), DockState.DockLeft, new AdditionalParam
            {
                Icon = "fa-certificate"
            });
        }

        public static void ShowDummyWindow(this DockPanel dockPanel, LocalesParser.MainMenu menu)
        {
            if (string.IsNullOrEmpty(menu.DockState))
            {
                menu.DockState = "Document";
            }
            DockState dockState = EnumHelper.ConvertTo<DockState>(menu.DockState);
            DockHelper.Show(dockPanel, menu.Tag, dockState, new AdditionalParam
            {
                Icon = menu.Icon,
                Text = menu.Title
            });
        }
    }
}
